﻿using BMSS.Models.Entity;
using BMSS.Services.BASE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BMSS.Services.System
{
    public class SysUserService : BaseServices<SysUser>, ISysUserService
    {
        public SysUserService()
        {
            
        }
        /// <summary>
        /// 根据Id获取用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public async Task<SysUser> GetUserInfo(long id)
        {
            var user = await base.Query(d => d.ID == id);
            if (user.Count > 0)
            {
                return user[0];
            }
            else
            {
                throw new Exception("用户名或密码错误！");
            }
        }
    }
}
